use common_uu::IResult;
use image::{GenericImageView, open};

mod px_480;
mod px_320;

pub fn run(block_path: String, big_path: String)  -> IResult<f64>{
    let pic = open(big_path.clone())?;
    let width = pic.width();
    match width{
        320 => {
            px_320::run(big_path, block_path)
        }
        480 => {
            px_480::run(big_path, block_path)
        }
        _ => {
            Err(format!("不支持的滑块图片大小: {}", width))?
        }
    }
}